package src.ten;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;

public class IteratorDemo {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<Integer>();
        for (int i = 0; i < 10; i++) {
            list.add(i);
        }
        System.out.println("列表中是全部元素：");
        ListIterator<Integer> it = list.listIterator();
        for (;it.hasNext();){
            //System.out.print(it.next()+",");
            it.next();
        }
       for(;it.hasPrevious();){
           System.out.print(it.previous()+",");
       }
    }
}
